package com.itany.corejava.code08_常用类.日期类;

import com.itany.corejava.util.DateUtil;
import com.itany.corejava.util.DateUtilConstant;

import java.text.ParseException;
import java.util.Date;

/**
 * @author 石小俊
 * @version 1.0
 * @date 2023年03月17日 13:39
 */
public class Test04_日期工具类 {

    public static void main(String[] args) throws ParseException {
        System.out.println(DateUtil.toString(new Date()));
        System.out.println(DateUtil.toString(new Date(), "yyyy年MM月dd日 HH:mm:ss"));
        System.out.println(DateUtil.toDate("2023-02-03 11:12:13"));
        System.out.println(DateUtil.toDate("2023年02月03日 11:12:13", "yyyy年MM月dd日 HH:mm:ss"));

        System.out.println(DateUtil.toString(DateUtil.getNextDay(new Date())));
        System.out.println(DateUtil.getDuringDay(DateUtil.toDate("2023-03-10 05:05:05"), new Date()));
        System.out.println(DateUtil.getDuringDay2(DateUtil.toDate("2023-03-10 05:05:05"), new Date()));
        System.out.println(DateUtil.get(new Date(), DateUtilConstant.YEAR) + "年");
        System.out.println(DateUtil.get(new Date(), DateUtilConstant.MONTH) + "月");
        System.out.println(DateUtil.get(new Date(), DateUtilConstant.DATE) + "日");
        System.out.println(DateUtil.get(new Date(), DateUtilConstant.HOUR) + "时");
        System.out.println(DateUtil.get(new Date(), DateUtilConstant.MINUTE) + "分");
        System.out.println(DateUtil.get(new Date(), DateUtilConstant.SECOND) + "秒");

    }

}
